import  request  from '@/utils/request'

//查询相对应的菜单
export function listMenu(menuDto){
  return request({
    url:'/pd-auth/menu/listMenu',
    method:'post',
    data:menuDto
  })
}

//新增菜单
export function addMenu(menu){
  return request({
    url:'/pd-auth/menu/addMenu',
    method:'post',
    data:menu,
  })
}

//修改菜单
export function updateMenu(menu){
  return request({
    url:'/pd-auth/menu/updateMenu',
    method:'post',
    data:menu,
  })
}

//根据id查询菜单信息
export function menuById(id){
  return request({
    url:`/pd-auth/menu/menuById/${id}`,
    method:'get'
  })
}

//根据id查询菜单权限配置分页条件查询
export function pageResource(resourceDTO){
  return request({
    url:`/pd-auth/resource/pageResource`,
    method:'post',
    data:resourceDTO,
  })
}

//下拉菜单
export function menuVos(){
  return request({
    url:`/pd-auth/menu/menuVos`,
    method:'get',
  })
}

//删除
export function delMenu(id){
  return request({
    url:`/pd-auth/menu/delMenu/${id}`,
    method:'get',
  })
}

/**
 *添加菜单配置
 * @param resource
 * @returns {Promise<AxiosResponse<any>> | *}
 */
export function insertResource(resource){
  return request({
    url:`/pd-auth/resource/insertResource`,
    method:'post',
    data:resource,
  })
}

//修改菜单权限配置
export function updateResource(resource){
  return request({
    url:`/pd-auth/resource/updateResource`,
    method:'post',
    data:resource,
  })
}

/**
 * 删除菜单权限配置
 * @param id
 */
export function deleteResource(id){
  return request({
    url:`/pd-auth/resource/deleteResource/${id}`,
    method:'get',
  })
}




